Switching to Angular by Minko Gechev
Author:Minko Gechev
Language: eng
Format: mobi, epub, pdf
Tags: COM060160 - COMPUTERS / Web / Web Programming, COM060180 - COMPUTERS / Web / Web Services and APIs, COM051260 - COMPUTERS / Programming Languages / JavaScript
Publisher: Packt Publishing
Published: 2017-10-31T08:26:31+00:00
Event bubbling
In Angular, we have the same bubbling behavior we're used to in the DOM. For instance, let's suppose we have the following template:
<input-box inputPlaceholder="New todo..." buttonLabel="Add" (click)="handleClick($event)" (inputText)="addTodo($event)"> </input-box>
The template declaration of the input-box component looks like this:
<input #todoInput [placeholder]="inputPlaceholder"> <button (click)="emitText(todoInput.value); todoInput.value = '';"> {{buttonLabel}} </button>
Once the user clicks on the button defined within the template of the input-box component, the handleClick($event) expression will be evaluated.
Further, the target property of the first argument of handleClick will be the button itself, but the currentTarget property will be the input-box element. The event will bubble the same way if we're not using Angular. At some point, it will reach the document unless a handler along the way doesn't stop its propagation.
In contrast, if we have a custom @Output decorator, the event will not bubble and instead of a DOM event object, the value of the $event variable will be the value that we pass to the emit method of the output.
Download
Switching to Angular by Minko Gechev.epub
Switching to Angular by Minko Gechev.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7810)
Grails in Action by Glen Smith Peter Ledbrook(7719)
Azure Containers Explained by Wesley Haakman & Richard Hooper(6862)
Configuring Windows Server Hybrid Advanced Services Exam Ref AZ-801 by Chris Gill(6861)
Running Windows Containers on AWS by Marcio Morales(6389)
Kotlin in Action by Dmitry Jemerov(5092)
Microsoft 365 Identity and Services Exam Guide MS-100 by Aaron Guilmette(5081)
Combating Crime on the Dark Web by Nearchos Nearchou(4657)
Microsoft Cybersecurity Architect Exam Ref SC-100 by Dwayne Natwick(4642)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4438)
The Ruby Workshop by Akshat Paul Peter Philips Dániel Szabó and Cheyne Wallace(4346)
The Age of Surveillance Capitalism by Shoshana Zuboff(3985)
Python for Security and Networking - Third Edition by José Manuel Ortega(3903)
The Ultimate Docker Container Book by Schenker Gabriel N.;(3568)
Learn Wireshark by Lisa Bock(3552)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3530)
Mastering Python for Networking and Security by José Manuel Ortega(3376)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3358)
Blockchain Basics by Daniel Drescher(3329)
